import React, { Component } from 'react';
import './inputBtn.scss'
import {  withRouter } from 'react-router-dom'

class inputBtn extends Component {

    state = {
        value:"",
    }

    componentDidMount=()=>{

        this.refs[this.props.name].value = this.props.value;

        // let ipt = document.getElementsByTagName['input'];


    }

    componentWillReceiveProps=()=>{
        this.refs[this.props.name].value = this.props.value;
    }

    changeInt=(ev)=>{
        let value = ev.target.value;
        console.log(value);
        this.refs[this.props.name].value = value;
        this.props.changeIptDataValue(value,this.props.index,this.props.num);
    }


    render() {
        return (
            <div className="inputBtn">
                <input name={this.props.name} ref={this.props.name} className="s_input" type="text" placeholder="" />
            </div>
        );
    }
}

export default withRouter(inputBtn);